<template>
    <rm-layout-left splitcolor="#F8F8FF" movingcolor="#00ff00" :splitwidth="0" :fixsize="0" :minfixsize="80" :canDrag="false">
        <rm-layout-top splitcolor="#F8F8FF" :splitwidth="5" :fixsize="layoutSize" :canDrag="false">
            <template v-slot:fix>
                <div :style="divCss">
                    <table border="0" style="font-size:12px; width: 100%;" class="table1style">
                        <col style="width:7%;" />
                        <col style="width:11%" />
                        <col style="width:1%" />
                        <col style="width:11%" />
                        <col style="width:5%" />
                        <col style="width:11%" />
                        <col style="width:6%" />
                        <col style="width:11%" />
                        <col style="width:5%" />
                        <col style="width:11%" />
                        <col style="width:5%" />
                        <col style="width:16%" />
                        <tr>
                            <td align="right">病历号|回单号</td>
                            <td colspan="3">
                                <el-input v-model="barcode" @keyup.enter.native="BtnQuery" id="inpbarcode" @click.native="BarCodeSelect('inpbarcode')" :placeholder="barcodeplaceholder" ref="searchbarcode">
                                    <template slot="append">
                                        <el-button @click.native="BtnReadCard" icon="el-icon-bank-card">读卡(F4)</el-button>
                                    </template>
                                </el-input>
                            </td>
                            <td align="right">
                                病人来源
                            </td>
                            <td align="right">
                                <rm-ddl-common datatype="seccode" kindno="PT" dataname="病人来源" v-model="pattype" width="100%"></rm-ddl-common>
                            </td>
                            <td align="right">
                                检验工作组
                            </td>
                            <td align="left">
                                <rm-ddl-common datatype="labgroup" dataname="检验工作组" v-model="labgroupid" width="100%"></rm-ddl-common>
                            </td>
                            <td align="right">
                                病人姓名
                            </td>
                            <td align="left">
                                <el-input v-model="patname" id="inppatname" style="width:100%" @keyup.enter.native="BtnQuery" @click.native="PatNameSelect('inppatname')" width="100%"></el-input>
                            </td>
                            <td>
                        <!-- 修改快捷查询的病人模糊查询 sel_qna_mh -->
                        <el-checkbox v-model="sel_patname_mh" true-label="1" false-label="0" style="padding-left: 5px; width: 70px">姓名模糊 </el-checkbox>
                        </td>
                        </tr>
                        <tr>
                            <td align="right">标本日期</td>
                            <td>
                                <el-date-picker v-model="SampleDatetime1" :clearable="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width:100%;">
                                </el-date-picker>
                            </td>
                            <td>至</td>
                            <td>
                                <el-date-picker v-model="SampleDatetime2" type="date" :clearable="false" placeholder="选择日期" value-format="yyyy-MM-dd" style="width:100%;"> </el-date-picker>
                            </td>
                            <td style="width:50px" align="right">送检医院</td>
                            <td align="left">
                                <rm-ddl-common datatype="hospital" dataname="医院" v-model="hospcode" width="100%"></rm-ddl-common>
                            </td>
                            <td align="right">申请科室</td>
                            <td>
                                <rm-ddl-common datatype="dept" dataname="科室" v-model="req_deptno" width="100%"></rm-ddl-common>
                            </td>
                            <td align="center" colspan="3">
                                <el-checkbox v-model="BtnSelectAllChecked" true-label="1" false-label="0">全选未打印</el-checkbox>
                                <el-checkbox v-model="BtnAllPrintedChecked" true-label="1" false-label="0">全选已打印</el-checkbox>
                            </td>
                        </tr>
                    </table>
                    <table style="width: 100%; font-size: 12px" border="0">
                        <col style="width: 80%" />
                        <col style="width: 20%" />
                        <tr>
                            <td colspan="12" align="right">
                                <el-button v-has="'PINQUERY'" type="primary" @click.native="BtnQuery" icon="el-icon-search">查询(F8)</el-button>
                                <el-button v-has="'PPRINT'" @click.native="BtnPrint" icon="el-icon-printer">打印</el-button>
                                <el-button v-has="'PPRINT'" @click.native="BtnPreView" icon="el-icon-monitor">预览</el-button>
                                <el-button @click.native="BtnClearSearch" icon="el-icon-close">清除条件</el-button>
                                <el-button @click.native="BtnClearCheck" icon="el-icon-circle-close">清除勾选</el-button>
                                <el-button @click.native="BtnReHelpPrint" icon="el-icon-set-up">恢复自助打印</el-button>
                            </td>
                        </tr>
                    </table>
                </div>
            </template>
            <template>
                <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
                    <el-tab-pane label="报告单" name="first">
                        <rm-layout-right splitcolor="#F8F8FF" movingcolor="#0000ff" :splitwidth="5" :fixsize="400">
                            <template v-slot:fix>
                                <div v-if="!showitem" style="height:100%" >
                                    <div v-if="rpttype == '1'" class="right-inser">
                                        <vxe-table ref="xTable2" :data.sync="tableDataRight" :loading="loadingRight" height="auto" border highlight-current-row highlight-hover-row resizable show-overflow="tooltip" show-header-overflow="tooltip" size="mini" stripe header-align="center" column-width="100px" >
                                            <vxe-table-column type="index" title="NO." width="50" v-if="novisible == 1"></vxe-table-column>
                                            <vxe-table-column field="rpt_itemname" title="检验项目" width="180">
                                                <template v-slot="{ row }">
                                                    <div v-if="row.alertflag == '1'" style="background:red;padding:0px 10px">
                                                        {{ row.rpt_itemname }}
                                                    </div>
                                                    <div v-else style="padding:0px 10px">
                                                        {{ row.rpt_itemname }}
                                                    </div>
                                                </template>
                                            </vxe-table-column>
                                            <vxe-table-column field="result_str" title="检验结果" width="70" align="center">
                                                <template v-slot="{ row }">
                                                    <div :style="{
                                                        background: row.cp_resultbackgroundcolor,
                                                        color: row.cp_resultcolor
                                                        }" style="padding:0px 10px">
                                                        {{ row.result_str }}
                                                    </div>
                                                </template>
                                            </vxe-table-column>

                                            <vxe-table-column field="result_ref" title="参考值" width="90px"></vxe-table-column>
                                            <vxe-table-column field="result_unit" title="单位" width="60" align="center"></vxe-table-column>
                                            <vxe-table-column field="result1" :title="result1text" width="70px" v-if="result1 == 1"></vxe-table-column>
                                            <vxe-table-column field="result2" :title="result2text" width="70px" v-if="result2 == 1"></vxe-table-column>
                                            <vxe-table-column field="result3" :title="result3text" width="70px" v-if="result3 == 1"></vxe-table-column>
                                            <vxe-table-column field="result_txt" title="大文本结果" width="160px"></vxe-table-column>
                                            <vxe-table-column field="alertflag" title="危急标志" width="60px" align="center" :formatter="['formatSelect', emer_flag]"></vxe-table-column>
                                            <vxe-table-column field="result_flag" title="结果标志" width="60px" align="center"></vxe-table-column>
                                            <vxe-table-column field="itemcode_en" title="英文缩写" width="80px" align="center"></vxe-table-column>
                                        </vxe-table>
                                    </div>
                                    <div v-if="rpttype == '2'" class="right-inser">
                                        <!-- <div v-if="is_ym" class="right-inser"> -->
                                        <div class="middle-tab-top">
                                                <vxe-table ref="xTable2" :data.sync="tableDataRight" :loading="loadingRight" height="300px" border highlight-current-row highlight-hover-row resizable show-overflow="tooltip"   show-header-overflow="tooltip" size="mini" stripe header-align="center" column-width="100px" @current-change="resultChange" >
                                                    <vxe-table-column type="index" title="NO." width="50" v-if="novisible == 1"></vxe-table-column>
                                                    <vxe-table-column field="rpt_itemname" title="检验项目" width="180">
                                                        <template v-slot="{ row }">
                                                            <div v-if="row.alertflag == '1'" style="background:red;padding:0px 10px">
                                                                {{ row.rpt_itemname }}
                                                            </div>
                                                            <div v-else style="padding:0px 10px">
                                                                {{ row.rpt_itemname }}
                                                            </div>
                                                        </template>
                                                    </vxe-table-column>
                                                    <vxe-table-column field="result_str" title="检验结果" width="70" align="center">
                                                        <template v-slot="{ row }">
                                                            <div :style="{
                                                                background: row.cp_resultbackgroundcolor,
                                                                color: row.cp_resultcolor
                                                                }" style="padding:0px 10px">
                                                                {{ row.result_str }}
                                                            </div>
                                                        </template>
                                                    </vxe-table-column>

                                                    <vxe-table-column field="result_ref" title="参考值" width="90px"></vxe-table-column>
                                                    <vxe-table-column field="result_unit" title="单位" width="60" align="center"></vxe-table-column>
                                                    <vxe-table-column field="result1" :title="result1text" width="70px" v-if="result1 == 1"></vxe-table-column>
                                                    <vxe-table-column field="result2" :title="result2text" width="70px" v-if="result2 == 1"></vxe-table-column>
                                                    <vxe-table-column field="result3" :title="result3text" width="70px" v-if="result3 == 1"></vxe-table-column>
                                                    <vxe-table-column field="result_txt" title="大文本结果" width="160px"></vxe-table-column>
                                                    <vxe-table-column field="alertflag" title="危急标志" width="60px" align="center" :formatter="['formatSelect', emer_flag]"></vxe-table-column>
                                                    <vxe-table-column field="result_flag" title="结果标志" width="60px" align="center"></vxe-table-column>
                                                    <vxe-table-column field="itemcode_en" title="英文缩写" width="80px" align="center"></vxe-table-column>
                                                </vxe-table>
                                        </div>
                                        <div style="height: calc(100% - 300px);margin-top: 300px" class="middle-tab-bottom">
                                            <vxe-table :data.sync="resusltmed_date" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border header-align="center" :height="ymresultheight" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="ymresulttable2" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }">
                                                <vxe-table-column field="medname" sortable title="抗生素" width="220" show-overflow></vxe-table-column>
                                                <vxe-table-column field="medresult" sortable title="药敏结果" header-align="center" align="center" width="60" show-overflow>
                                                    <template v-slot="{ row }">
                                                        <div :style="{
                                                                background: row.cp_resultbackgroundcolor,
                                                                color: row.cp_resultcolor,
                                                            }" style="padding: 0px 10px">
                                                            {{ row.medresult }}
                                                        </div>
                                                    </template>
                                                </vxe-table-column>
                                                <vxe-table-column field="rad" sortable title="Rad" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="mic" sortable title="Mic" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result_flag" align="center" sortable title="标志" width="60" show-overflow></vxe-table-column>
                                                <vxe-table-column field="result6" sortable title="参考范围" width="120" show-overflow></vxe-table-column>
                                                <vxe-table-column field="expertresult" sortable title="专家值" width="100" show-overflow></vxe-table-column>
                                                <vxe-table-column field="medgroup" align="center" sortable title="分组" width="80" show-overflow></vxe-table-column>
                                                <!-- <template v-slot:fix>
                                                    <div style="font-size: 12px; padding-top: 3px; background-color: #fff">
                                                        <span style="color: red; margin-left: 10px; float: right">合计: {{ ymresultitem_amount }}</span>
                                                        <div style="clear: both"></div>
                                                    </div>
                                                </template> -->
                                            </vxe-table>
                                        </div>
                                    </div>
                                    <div v-if="rpttype == '3'" class="right-inser">
                                        <div style="height: calc(100% - 5px); width: calc(100% - 5px)">
                                            <iframe :src="image" style="width: 100%; height: 100%"></iframe>
                                        </div>
                                    </div>
                                </div>
                                <div v-else style="height:100%;border:1px solid #CCC;overflow:auto">
                                    <div  style="font-size:18px;font-weight:800;padding:10px;color:red">
                                        {{ showmsg }}
                                    </div>
                                </div>
                            </template>

                            <div style="height:100%;width:100%;background-color:#ddccbb;">
                                <vxe-table :data.sync="tableDataLeft" :loading="loadingLeft" height="auto" border highlight-current-row highlight-hover-row resizable show-overflow="tooltip" size="mini" header-align="center" ref="xTable1" @cell-dblclick="xTable1Celldblclick" :row-class-name="rowClassName" @current-change="currentChangeEvent" :sort-config="{ trigger: 'cell' }" :cell-class-name="cellClassName" :key="reportKey">
                                    <vxe-table-column type="index" title="NO." align="center" width="50"></vxe-table-column>
                                    <vxe-table-column field="cp_rechked" title="审" width="40px" align="center" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_no" title="病历号" width="110px" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_name" title="姓名" width="80px" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_agestr" title="年龄" width="50px" align="center" sortable></vxe-table-column>

                                    <vxe-table-column field="report_dt" title="报告时间" width="120" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="rptunitname" title="报告单元" width="100px" sortable></vxe-table-column>
                                    <vxe-table-column field="cp_selection" title="打印选择" width="50px" align="center" sortable>
                                        <template  v-slot="{ row, rowIndex }">
                                            <div v-if="row.rechkflag=='9'">
                                                <el-checkbox v-model="row.cp_selection" true-label="1" false-label="0" @change="handleCheckedPrintChange(row, rowIndex)"></el-checkbox>
                                            </div>
                                            <div v-else style="background-color:red;color:white">禁</div>
                                        </template>
                                    </vxe-table-column>
                                    <vxe-table-column field="print_count" title="打印次数" width="50" align="center" sortable></vxe-table-column>
                                    <vxe-table-column field="lastprint_dt" title="最后打印时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="unprint_reason" title="禁止打印提示" width="120px" sortable></vxe-table-column>
                                    <vxe-table-column field="barcode" title="条码号" width="120px" sortable></vxe-table-column>

                                    <vxe-table-column field="exprint_count" title="外部打印次数" width="65" align="center" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_sex" title="性别" width="40px" align="center" sortable></vxe-table-column>

                                    <vxe-table-column field="resultclass" title="报告类别" width="90px" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_typecode" title="病人类型" width="90px" sortable></vxe-table-column>

                                    <vxe-table-column field="unprint_flag" title="禁止打印" width="80px" align="center" sortable :formatter="FormateFun"></vxe-table-column>
                                    <vxe-table-column field="req_deptno" title="申请科室" width="100px" sortable></vxe-table-column>
                                    <vxe-table-column field="req_reason" title="检验目的" width="120px" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_cardno" title="卡号" width="120px" sortable></vxe-table-column>
                                    <vxe-table-column field="pat_id" title="病人ID" width="110px" sortable></vxe-table-column>
                                    <vxe-table-column field="specimen_code" title="标本类型" width="100px" sortable></vxe-table-column>
                                    <vxe-table-column field="sampledate" title="标本日期" width="90px" sortable :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                                    <vxe-table-column field="sampleno" title="标本号" width="66px" sortable></vxe-table-column>
                                    <vxe-table-column field="reportid" title="报告ID" width="130px" sortable></vxe-table-column>
                                    <vxe-table-column field="emer_flag" title="加急" width="50px" align="center" sortable></vxe-table-column>
                                    <vxe-table-column field="report_user" title="检验者" width="70px" sortable></vxe-table-column>
                                    <vxe-table-column field="rechk_user" title="核对者" width="70px" sortable></vxe-table-column>
                                    <vxe-table-column field="req_dt" title="申请时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="sampled_dt" title="采样时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="recieve_dt" title="接收时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="input_dt" title="录入时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="test_dt" title="上机时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="rechk_dt" title="审核时间" width="120px" sortable :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="pat_idcardno" title="身份证号/护照号" width="150px"></vxe-table-column>
                                    <vxe-table-column field="pat_phone" title="联系电话" width="100px"></vxe-table-column>
                                    <vxe-table-column field="report_comm" title="备注" width="120px" sortable></vxe-table-column>
                                    <vxe-table-column field="req_bedno" title="床号" width="70px" sortable></vxe-table-column>
                                    <vxe-table-column field="prereport" title="初步报告" width="50px" sortable align="center">
                                        <template v-slot="{ row }">
                                            <el-checkbox v-model="row.prereport" true-label="1" false-label="0" :disabled="true"></el-checkbox>
                                        </template>
                                    </vxe-table-column>
                                    <vxe-table-column field="notserviceprint" title="禁止服务台打印" width="70px" sortable align="center">
                                        <template v-slot="{ row }">
                                            <el-checkbox v-model="row.notserviceprint" true-label="1" false-label="0" :disabled="true"></el-checkbox>
                                        </template>
                                    </vxe-table-column>
                                    <vxe-table-column field="req_docno" title="申请医生" width="90px" sortable></vxe-table-column>
                                    <vxe-table-column field="log_user" title="最近打印用户" width="80px" sortable></vxe-table-column>
                                    <vxe-table-column field="computer_name" title="最近打印计算机" width="140px" sortable>
                                        <template v-slot="{ row }">
                                            <span style="color:blue;">{{row.computer_name}}</span>
                                            <i class="el-icon-refresh" @click="repalceComputerName(row)"></i>
                                        </template>
                                    </vxe-table-column>
                                    <vxe-table-column field="mac_address" title="最近打印地址" width="130px" sortable></vxe-table-column>
                                    <vxe-table-column field="log_content" title="最近打印操作" width="110px" sortable></vxe-table-column>
                                    <vxe-table-column field="req_groupid" title="分单类别" width="100px" sortable></vxe-table-column>
                                    <vxe-table-column field="unprint_flag" title="禁止打印标志" width="100px" sortable></vxe-table-column>

                                </vxe-table>
                            </div>
                        </rm-layout-right>
                    </el-tab-pane>
                    <el-tab-pane label="申请单" name="second" v-if="rptsvr_showreq == '1'">
                        <div style="height:100%">
                            <vxe-table :data.sync="tableDataReq" :loading="loading" height="auto" border highlight-current-row highlight-hover-row resizable :row-class-name="rowClassName_REQ" show-overflow="tooltip" size="mini" header-align="center" ref="xTable3" :key="testkey" :cell-class-name="cellClassName_REQ">
                                <vxe-table-column type="index" title="NO." align="center" width="60"></vxe-table-column>
                                <vxe-table-column field="pat_typename" title="病人来源" width="60px"></vxe-table-column>
                                <vxe-table-column field="report_dt" title="报告时间" width="120" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="pat_no" title="病历号" width="110px"></vxe-table-column>
                                <vxe-table-column field="pat_name" title="姓名" width="70px"></vxe-table-column>
                                <vxe-table-column field="req_groupna" title="分单类别" width="80px"></vxe-table-column>
                                <vxe-table-column field="barcode" title="条码号" width="120px"></vxe-table-column>
                                <vxe-table-column field="emer_flag" title="加急" width="30" :formatter="['formatSelect', emer_flag]"></vxe-table-column>
                                <vxe-table-column field="sample_items" title="申请项目(简称，部分)" width="140px"></vxe-table-column>
                                <vxe-table-column field="req_statname" title="状态" width="70px"></vxe-table-column>
                                <vxe-table-column field="create_dt" title="创建时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="recieve_dt" title="接收时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="recieve_username" title="接收人" width="70"></vxe-table-column>
                                <vxe-table-column field="test_dt" title="上机时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="test_username" title="上机人" width="70px"></vxe-table-column>
                                <vxe-table-column field="req_deptname" title="申请科室" width="100px"></vxe-table-column>
                                <vxe-table-column field="req_docname" title="申请医生" width="80px"></vxe-table-column>
                                <vxe-table-column field="req_bedno" title="床号" width="60px"></vxe-table-column>
                                <vxe-table-column field="specimen_name" title="标本类型" width="90px"></vxe-table-column>
                                <vxe-table-column field="pat_sexname" title="性别" width="30px"></vxe-table-column>
                                <vxe-table-column field="pat_agestr" title="年龄" width="70px"></vxe-table-column>
                                <vxe-table-column field="base_amount" title="应收金额" width="80px"></vxe-table-column>
                                <vxe-table-column field="labadd" title="实验室增加标志" width="70px">
                                    <template  v-slot="{ row }">
                                        <el-checkbox true-label="1" false-label="0" v-model="row.labadd" disabled="disabled"></el-checkbox>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="create_username" title="创建人" width="80px"></vxe-table-column>
                                <vxe-table-column field="print_dt" title="打印/执行时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="print_username" title="打印/执行人" width="70px"></vxe-table-column>
                                <vxe-table-column field="print_count" title="打印次数" width="50px"></vxe-table-column>
                                <vxe-table-column field="sampled_dt" title="采样时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="sampled_username" title="采样人" width="70px"></vxe-table-column>
                                <vxe-table-column field="req_dt" title="申请时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="prereport_dt" title="预出报告时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="prereport_comm" title="报告领取说明" width="120px"></vxe-table-column>
                                <vxe-table-column field="pat_diag" title="临床诊断" width="100px"></vxe-table-column>
                                <vxe-table-column field="pat_id" title="病人ID号" width="110px"></vxe-table-column>
                                <vxe-table-column field="inp_date" title="入院日期" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="send_dt" title="送出时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="send_username" title="送出人" width="70px"></vxe-table-column>
                                <vxe-table-column field="charge_dt" title="计价时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="charge_username" title="计价人" width="70px"></vxe-table-column>
                                <vxe-table-column field="amount" title="实收金额" width="70px"></vxe-table-column>
                                <vxe-table-column field="charge_flag" title="计价标志" width="50px"></vxe-table-column>
                                <vxe-table-column field="report_username" title="检验医生姓名" width="70px"></vxe-table-column>
                                <vxe-table-column field="rechk_username" title="核对医生姓名" width="70px"></vxe-table-column>
                                <vxe-table-column field="alter_flag" title="报警" width="40px" :formatter="format"></vxe-table-column>
                                <vxe-table-column field="saleman" title="销售员" width="70px"></vxe-table-column>
                                <vxe-table-column field="pat_cardno" title="就诊卡号" width="110px"></vxe-table-column>
                                <vxe-table-column field="req_comm" title="医生备注" width="150px"></vxe-table-column>
                                <vxe-table-column field="pat_birth" title="生日" width="90px" :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                                <vxe-table-column field="pat_agestr" title="年龄岁数" width="50px"></vxe-table-column>
                                <vxe-table-column field="inp_id" title="住院标识" width="100px"></vxe-table-column>
                                <vxe-table-column field="pat_cardno" title="就诊号" width="100px"></vxe-table-column>
                                <vxe-table-column field="pat_diag_icd" title="诊断标准代码" width="100px"></vxe-table-column>
                                <vxe-table-column field="pat_address" title="地址" width="150px"></vxe-table-column>
                                <vxe-table-column field="pat_nation" title="国籍" width="60px"></vxe-table-column>
                                <vxe-table-column field="pat_idcardno" title="身份证号/护照号" width="150px"></vxe-table-column>
                                <vxe-table-column field="pat_phone" title="联系电话" width="100px"></vxe-table-column>
                                <vxe-table-column field="charge_typename" title="费别" width="100px"></vxe-table-column>
                                <vxe-table-column field="perform_deptname" title="执行科室" width="100px"></vxe-table-column>
                                <vxe-table-column field="req_wardname" title="病区" width="100px"></vxe-table-column>
                                <vxe-table-column field="original_reqno" title="原始申请单号" width="110px"></vxe-table-column>
                                <vxe-table-column field="secrecy" title="加密" width="40px"></vxe-table-column>
                                <vxe-table-column field="other_stat" title="其他状态" width="100px"></vxe-table-column>
                                <vxe-table-column field="cancel_dt" title="作废时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="cancel_user" title="做废人" width="70px"></vxe-table-column>
                                <vxe-table-column field="reject_dt" title="踢回时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="reject_user" title="踢回人" width="70px"></vxe-table-column>
                                <vxe-table-column field="reject_reason" title="踢回原因" width="100px"></vxe-table-column>
                                <vxe-table-column field="reject_count" title="踢回次数" width="50px"></vxe-table-column>
                                <vxe-table-column field="specimen_code" title="标本类型代码" width="100px"></vxe-table-column>
                                <vxe-table-column field="sample_detail" title="标本备注说明" width="130px"></vxe-table-column>
                                <vxe-table-column field="req_reason" title="检验目的" width="100px"></vxe-table-column>
                                <vxe-table-column field="master_barcode" title="主申请单ID" width="70px"></vxe-table-column>
                                <vxe-table-column field="multi_seq" title="子申请单序号" width="70px"></vxe-table-column>
                                <vxe-table-column field="req_groupid" title="分单类别ID" width="70px"></vxe-table-column>
                                <vxe-table-column field="report_id" title="报告单ID" width="70px"></vxe-table-column>
                                <vxe-table-column field="report_user" title="检验医生代码" width="100px"></vxe-table-column>
                                <vxe-table-column field="rechk_user" title="核对医生代码" width="100px"></vxe-table-column>
                                <vxe-table-column field="recieve1_dt" title="工作组签收时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="recieve1_user" title="工作组签收人" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="inlib_status" title="入库状态" width="80px"></vxe-table-column>
                                <vxe-table-column field="library_id" title="所在库位ID" width="70px"></vxe-table-column>
                                <vxe-table-column field="reqtype" title="申请单类别" width="60px" :formatter="format"></vxe-table-column>
                                <vxe-table-column field="pat_height" title="身高" width="70px"></vxe-table-column>
                                <vxe-table-column field="weight" title="体重" width="70px"></vxe-table-column>
                                <vxe-table-column field="abo_bldtype" title="ABO血型" width="100px"></vxe-table-column>
                                <vxe-table-column field="rh_bldtype" title="RH血型" width="100px"></vxe-table-column>
                                <!-- <vxe-table-column field="inputcode" title="拟输血时间" width="110px"></vxe-table-column>
                                <vxe-table-column field="inputcode" title="输血目的" width="100px"></vxe-table-column>
                                <vxe-table-column field="inputcode" title="既往有输血史" width="130px"></vxe-table-column>
                                <vxe-table-column field="inputcode" title="既往有妊娠史" width="130px"></vxe-table-column>
                                <vxe-table-column field="inputcode" title="孕育次数" width="110px"></vxe-table-column>
                                <vxe-table-column field="inputcode" title="生产次数" width="110px"></vxe-table-column>
                                <vxe-table-column field="inputcode" title="输血不良反应记录史" width="140px"></vxe-table-column> -->
                                <vxe-table-column field="collectbarcode" title="回单条码号" width="120px"></vxe-table-column>
                                <vxe-table-column field="log_user" title="延迟发布报告" width="120px"></vxe-table-column>
                                <vxe-table-column field="log_date" title="延迟发布报告操作时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                <vxe-table-column field="log_content" title="延迟发布报告原因" width="150px"></vxe-table-column>
                            </vxe-table>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane :label="UndetectionTitle" :name="showUndetectionNum != '0' ? 'TabColorUndetection' : 'third'" v-if="rptsvr_showreq == '1'" key="third">
                        <rm-layout-right splitcolor="#F8F8FF" movingcolor="#0000ff" :splitwidth="5" :fixsize="400">
                            <template v-slot:fix>
                                <div style="height: 100%">
                                    <div class="right-inser">
                                        <vxe-table :data.sync="tableDataReqUndetectionLog" height="100%" highlight-current-row highlight-hover-row resizable header-align="center" show-overflow="tooltip" show-header-overflow="tooltip" size="mini" border stripe ref="ReqUndetectionLog" :key="undetectionlogkey">
                                            <vxe-table-column field="log_date" title="操作日期" width="120px" align="center"></vxe-table-column>
                                            <vxe-table-column field="trans_type" title="操作类型" width="80px" align="center" :formatter="['formatSelect', reqstatOptiontable]"></vxe-table-column>
                                            <vxe-table-column field="log_content" title="操作内容" width="220px" tree-node>
                                                <template v-slot="{ row }">
                                                    <div style="max-width: 180px; display: inline-block">{{ row.log_content }}</div>
                                                </template>
                                            </vxe-table-column>
                                            <vxe-table-column field="username" title="操作者" width="100px" align="center"></vxe-table-column>
                                            <vxe-table-column field="ref_user" title="相关人" width="100px"></vxe-table-column>
                                            <vxe-table-column field="labgroupid" title="工作组" width="100px"></vxe-table-column>
                                            <vxe-table-column field="computer_name" title="操作时机器名" width="100px">
                                                <template v-slot="{ row }">
                                                    <span style="color:blue;">{{row.computer_name}}</span>
                                                    <i class="el-icon-refresh" @click="repalceComputerName(row)"></i>
                                                </template>
                                            </vxe-table-column>
                                            <vxe-table-column field="mac_address" title="操作时机器MAC" width="100px"></vxe-table-column>
                                            <vxe-table-column field="syncflag" title="同步HIS标志" width="100px"></vxe-table-column>
                                            <vxe-table-column field="synctime" title="同步时间" width="100px"></vxe-table-column>
                                            <vxe-table-column field="syncerrtext" title="同步失败信息" width="100px"></vxe-table-column>
                                        </vxe-table>
                                    </div>
                                </div>
                            </template>
                            <div style="height:100%;width:100%;">
                                <vxe-table :data.sync="tableDataReqUndetection" height="100%" border highlight-current-row highlight-hover-row resizable  :row-class-name="rowClassName_REQ" show-overflow="tooltip" size="mini" header-align="center" @current-change="currentUndetectionChangeEvent" ref="xTable_Undetection" :key="undetectionkey" :cell-class-name="cellClassName_REQ">
                                    <vxe-table-column type="index" title="NO." align="center" width="60"></vxe-table-column>
                                    <vxe-table-column field="pat_typename" title="病人来源" width="60px"></vxe-table-column>
                                    <vxe-table-column field="pat_no" title="病历号" width="110px"></vxe-table-column>
                                    <vxe-table-column field="pat_name" title="姓名" width="70px"></vxe-table-column>
                                    <vxe-table-column field="req_groupna" title="分单类别" width="80px"></vxe-table-column>
                                    <vxe-table-column field="barcode" title="条码号" width="120px"></vxe-table-column>
                                    <vxe-table-column field="emer_flag" title="加急" width="30" :formatter="['formatSelect', emer_flag]"></vxe-table-column>
                                    <vxe-table-column field="sample_items" title="申请项目(简称，部分)" width="140px"></vxe-table-column>
                                    <vxe-table-column field="req_statname" title="状态" width="70px"></vxe-table-column>
                                    <vxe-table-column field="create_dt" title="创建时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="recieve_dt" title="接收时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="recieve_username" title="接收人" width="70"></vxe-table-column>
                                    <vxe-table-column field="req_deptname" title="申请科室" width="100px"></vxe-table-column>
                                    <vxe-table-column field="req_docname" title="申请医生" width="80px"></vxe-table-column>
                                    <vxe-table-column field="req_bedno" title="床号" width="60px"></vxe-table-column>
                                    <vxe-table-column field="specimen_name" title="标本类型" width="90px"></vxe-table-column>
                                    <vxe-table-column field="pat_sexname" title="性别" width="30px"></vxe-table-column>
                                    <vxe-table-column field="pat_agestr" title="年龄" width="70px"></vxe-table-column>
                                    <vxe-table-column field="base_amount" title="应收金额" width="80px"></vxe-table-column>
                                    <vxe-table-column field="labadd" title="实验室增加标志" width="70px">
                                        <template  v-slot="{ row }">
                                            <el-checkbox true-label="1" false-label="0" v-model="row.labadd" disabled="disabled"></el-checkbox>
                                        </template>
                                    </vxe-table-column>
                                    <vxe-table-column field="create_username" title="创建人" width="80px"></vxe-table-column>
                                    <vxe-table-column field="print_dt" title="打印/执行时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="print_username" title="打印/执行人" width="70px"></vxe-table-column>
                                    <vxe-table-column field="print_count" title="打印次数" width="50px"></vxe-table-column>
                                    <vxe-table-column field="sampled_dt" title="采样时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="sampled_username" title="采样人" width="70px"></vxe-table-column>
                                    <vxe-table-column field="req_dt" title="申请时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="prereport_dt" title="预出报告时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="prereport_comm" title="报告领取说明" width="120px"></vxe-table-column>
                                    <vxe-table-column field="pat_diag" title="临床诊断" width="100px"></vxe-table-column>
                                    <vxe-table-column field="pat_id" title="病人ID号" width="110px"></vxe-table-column>
                                    <vxe-table-column field="inp_date" title="入院日期" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="send_dt" title="送出时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="send_username" title="送出人" width="70px"></vxe-table-column>
                                    <vxe-table-column field="charge_dt" title="计价时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="charge_username" title="计价人" width="70px"></vxe-table-column>
                                    <vxe-table-column field="amount" title="实收金额" width="70px"></vxe-table-column>
                                    <vxe-table-column field="charge_flag" title="计价标志" width="50px"></vxe-table-column>
                                    <vxe-table-column field="report_username" title="检验医生姓名" width="70px"></vxe-table-column>
                                    <vxe-table-column field="rechk_username" title="核对医生姓名" width="70px"></vxe-table-column>
                                    <vxe-table-column field="alter_flag" title="报警" width="40px" :formatter="format"></vxe-table-column>
                                    <vxe-table-column field="saleman" title="销售员" width="70px"></vxe-table-column>
                                    <vxe-table-column field="pat_cardno" title="就诊卡号" width="110px"></vxe-table-column>
                                    <vxe-table-column field="req_comm" title="医生备注" width="150px"></vxe-table-column>
                                    <vxe-table-column field="pat_birth" title="生日" width="90px" :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                                    <vxe-table-column field="pat_agestr" title="年龄岁数" width="50px"></vxe-table-column>
                                    <vxe-table-column field="inp_id" title="住院标识" width="100px"></vxe-table-column>
                                    <vxe-table-column field="pat_cardno" title="就诊号" width="100px"></vxe-table-column>
                                    <vxe-table-column field="pat_diag_icd" title="诊断标准代码" width="100px"></vxe-table-column>
                                    <vxe-table-column field="pat_address" title="地址" width="150px"></vxe-table-column>
                                    <vxe-table-column field="pat_nation" title="国籍" width="60px"></vxe-table-column>
                                    <vxe-table-column field="pat_idcardno" title="身份证号/护照号" width="150px"></vxe-table-column>
                                    <vxe-table-column field="pat_phone" title="联系电话" width="100px"></vxe-table-column>
                                    <vxe-table-column field="charge_typename" title="费别" width="100px"></vxe-table-column>
                                    <vxe-table-column field="perform_deptname" title="执行科室" width="100px"></vxe-table-column>
                                    <vxe-table-column field="req_wardname" title="病区" width="100px"></vxe-table-column>
                                    <vxe-table-column field="original_reqno" title="原始申请单号" width="110px"></vxe-table-column>
                                    <vxe-table-column field="secrecy" title="加密" width="40px"></vxe-table-column>
                                    <vxe-table-column field="other_stat" title="其他状态" width="100px"></vxe-table-column>
                                    <vxe-table-column field="cancel_dt" title="作废时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="cancel_user" title="做废人" width="70px"></vxe-table-column>
                                    <vxe-table-column field="reject_dt" title="踢回时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="reject_user" title="踢回人" width="70px"></vxe-table-column>
                                    <vxe-table-column field="reject_reason" title="踢回原因" width="100px"></vxe-table-column>
                                    <vxe-table-column field="reject_count" title="踢回次数" width="50px"></vxe-table-column>
                                    <vxe-table-column field="specimen_code" title="标本类型代码" width="100px"></vxe-table-column>
                                    <vxe-table-column field="sample_detail" title="标本备注说明" width="130px"></vxe-table-column>
                                    <vxe-table-column field="req_reason" title="检验目的" width="100px"></vxe-table-column>
                                    <vxe-table-column field="master_barcode" title="主申请单ID" width="70px"></vxe-table-column>
                                    <vxe-table-column field="multi_seq" title="子申请单序号" width="70px"></vxe-table-column>
                                    <vxe-table-column field="req_groupid" title="分单类别ID" width="70px"></vxe-table-column>
                                    <vxe-table-column field="report_id" title="报告单ID" width="70px"></vxe-table-column>
                                    <vxe-table-column field="report_user" title="检验医生代码" width="100px"></vxe-table-column>
                                    <vxe-table-column field="rechk_user" title="核对医生代码" width="100px"></vxe-table-column>
                                    <vxe-table-column field="recieve1_dt" title="工作组签收时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="recieve1_user" title="工作组签收人" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="inlib_status" title="入库状态" width="80px"></vxe-table-column>
                                    <vxe-table-column field="library_id" title="所在库位ID" width="70px"></vxe-table-column>
                                    <vxe-table-column field="reqtype" title="申请单类别" width="60px" :formatter="format"></vxe-table-column>
                                    <vxe-table-column field="pat_height" title="身高" width="70px"></vxe-table-column>
                                    <vxe-table-column field="weight" title="体重" width="70px"></vxe-table-column>
                                    <vxe-table-column field="abo_bldtype" title="ABO血型" width="100px"></vxe-table-column>
                                    <vxe-table-column field="rh_bldtype" title="RH血型" width="100px"></vxe-table-column>
                                    <!-- <vxe-table-column field="inputcode" title="拟输血时间" width="110px"></vxe-table-column>
                                    <vxe-table-column field="inputcode" title="输血目的" width="100px"></vxe-table-column>
                                    <vxe-table-column field="inputcode" title="既往有输血史" width="130px"></vxe-table-column>
                                    <vxe-table-column field="inputcode" title="既往有妊娠史" width="130px"></vxe-table-column>
                                    <vxe-table-column field="inputcode" title="孕育次数" width="110px"></vxe-table-column>
                                    <vxe-table-column field="inputcode" title="生产次数" width="110px"></vxe-table-column>
                                    <vxe-table-column field="inputcode" title="输血不良反应记录史" width="140px"></vxe-table-column> -->
                                    <vxe-table-column field="collectbarcode" title="回单条码号" width="120px"></vxe-table-column>
                                    <vxe-table-column field="log_user" title="延迟发布报告" width="120px"></vxe-table-column>
                                    <vxe-table-column field="log_date" title="延迟发布报告操作时间" width="120px" :formatter="['toDateString', 'yyyy-MM-dd HH:mm']"></vxe-table-column>
                                    <vxe-table-column field="log_content" title="延迟发布报告原因" width="150px"></vxe-table-column>
                                </vxe-table>
                            </div>
                        </rm-layout-right>
                    </el-tab-pane>
                </el-tabs>
            </template>
        </rm-layout-top>
        <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" v-el-drag-dialog :close-on-click-modal="false">
            <div style="font-size:18px;font-weight:800;">{{ msg }}</div>
        </el-dialog>

        <el-dialog title="检验报告操作日志" :visible.sync="OperateDialog" width="80%">
            <div style="height:400px">
                <vxe-table show-overflow ref="xTable4" height="auto" :loading="xTable4loading" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" :mouse-config="{ selected: true }" :data.sync="tableData4" border size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe :edit-config="{
                    trigger: 'click',
                    mode: 'cell',
                    showStatus: true,
                    showIcon: false
                }">
                    <vxe-table-column type="index" title="NO." width="50"></vxe-table-column>
                    <vxe-table-column field="log_date" title="操作日期" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="rptlogtype" title="操作类型" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="log_user" title="操作者" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="log_content" title="操作内容" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="computer_name" title="操作时机器名" width="160" sortable header-align="center">
                        <template v-slot="{ row }">
                            <span style="color:blue;">{{row.computer_name}}</span>
                            <i class="el-icon-refresh" @click="repalceComputerName(row)"></i>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="reportflag" title="报告标志" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="mac_address" title="操作时机器MAC" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="rptunitid" title="报告单元ID" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="sampledate" title="标本日期" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="sampleno" title="标本号" width="160" sortable header-align="center"></vxe-table-column>
                    <vxe-table-column field="reportid" title="报告ID" width="160" sortable header-align="center"></vxe-table-column>
                </vxe-table>
            </div>
        </el-dialog>

        <el-dialog title="提示" :visible.sync="showMsg" v-el-drag-dialog :close-on-click-modal="false" width="30%" :destroy-on-close="true">
            {{ msgtext }}
            <div slot="footer" class="dialog-footer">
                <el-button icon="el-icon-news" @click="dialogok()" ref="btnfocus0">确定</el-button>
            </div>
        </el-dialog>
    </rm-layout-left>
</template>


<script type="text/javascript">
import XEUtils from "xe-utils"; //引入工具类
XEUtils.mixin({
    // 自定义全局的格式化处理函数
    formatSelect(cellValue, list) {
        let item = list.find((item) => item.value == cellValue);
        return item ? item.label : "";
    },
});
export default {
    name: "LIS421",
    data() {
        return {
            reportKey: 0,
            undetectionkey: 0,
            undetectionlogkey: 0,
            showMsg: false,
            msgtext: "",
            macaddress: "",
            barcode: "",
            req_deptno: "",
            SampleDatetime1: this.$pub.InitDateTime2(30).datefrom,
            SampleDatetime2: this.$pub.InitDateTime2(30).dateto,
            labgroupid: "",
            deptgroup: "",
            pattype: "",
            patname: "",
            hospcode: "",
            labgroupids: [],
            deptgroups: [],
            pattypes: [],
            tableDataRight: [],
            tableDataLeft: [],
            tableDataReq: [],
            tableData4: [],
            loadingRight: false,
            loadingLeft: false,
            loading: false,
            xTable4loading: false,
            activeName: "first",
            reportid: "",
            rptunitid: "",
            OptionLocalList: "",
            OptionList: "",
            okFirstLoading: true,
            interfacename: "",
            testkey: 0,
            userno: this.$tool.getSession(this.$tool.loginuserno),
            dialogVisible: false,
            msg: "",
            novisible: "",
            OperateDialog: false,
            result1text: "",
            result2text: "",
            result3text: "",
            result1: "",
            result2: "",
            result3: "",
            barcodeplaceholder: "",
            showitem: false,
            showmsg: "",
            rptsvr_showreq: "",
            rowpatno: "",
            rowpatname: "",
            emer_flag: [{ label: "急", value: "1" }],
            BtnSelectAllChecked: "0",
            BtnAllPrintedChecked: "0",
            autoprintuselisrpt: "0",
            shownochkreport: "",
            rpttype:"1",
            resusltmed_date: [],
            ymresultheight: "auto",
            sel_patname_mh:"0",
            divCss: {
                height: '95px',
                border: '1px solid #CCC',
            },
            layoutSize: 95,
            tableDataReqUndetection: [],
            tableDataReqUndetectionLog: [],
            UndetectionTitle: "未上机申请单",
            showUndetectionNum: '0',
            tempBarcode: "",
            reqstatOptiontable: [],
        };
    },
    watch: {
        BtnSelectAllChecked(val) {
            this.tableDataLeft.forEach((item) => {
                if (item.print_count == 0) {
                    if (["1", "2", "8"].includes(item.unprint_flag) || item.rechkflag != "9" || item.notserviceprint == "1" || item.prereport == "1") {
                        item.cp_selection = "0";
                        return;
                    }
                    item.cp_selection = val == true ? "1" : "0";
                }
            });
        },
        BtnAllPrintedChecked(val) {
            this.tableDataLeft.forEach((item) => {
                if (item.print_count > 0) {
                    if (["1", "2", "8"].includes(item.unprint_flag) || item.rechkflag != "9" || item.notserviceprint == "1" || item.prereport == "1") {
                        item.cp_selection = "0";
                        return;
                    }
                    item.cp_selection = val == true ? "1" : "0";
                }
            });
        },
    },
    created() {
        this.getOption(); //初始化下拉框的数据
        this.setDivCss();//设置搜索框样式，避免低分辨率下样式变形
    },
    activated() {
        this.$refs.searchbarcode.focus();
        this.$refs.searchbarcode.select();
    },
    mounted() {
        //定义快捷键F4 F8
        var _this = this;
        document.onkeydown = function (e) {
            let key = window.event.keyCode;
            switch (key) {
                case 115: //读卡F4
                    _this.BtnReadCard();
                    break;
                case 119: //查询F8
                    _this.BtnQuery();
                    break;
            }
        };
        this.$refs.searchbarcode.focus();
        this.$refs.searchbarcode.select();
    },
    updated() {
        if (this.okFirstLoading) {
            this.$nextTick(() => {
                let currentrow = this.$refs.xTable1.getData(0);
                if (currentrow) {
                    this.okFirstLoading = false;
                    this.$refs.xTable1.setCurrentRow(currentrow);
                    this.reportid = currentrow.reportid;
                    this.rptunitid = currentrow.rptunitid;
                    this.rowpatno = currentrow.pat_no;
                    this.rowpatname = currentrow.pat_name;
                    this.getLabResult();
                    this.getReq();
                }
            });
        }
    },
    methods: {
        async Dec(ciphertext, name) {
            try {
                const res = await this.$tool.request({
                    url: "ucent/ddl",
                    method: "post",
                    data: {
                        action: "sm4decrypt",
                        ciphertext: ciphertext,
                    },
                });
                if (res) {
                    this.$alert(res, name, {
                        confirmButtonText: "确定",
                    });
                }
            } catch (e) {
                this.$message.warning(e);
            }
        },
        setDivCss(){
            var w = document.body.offsetWidth;
            if(w < 1280){
                this.divCss = {
                    height: '105px',
                    border: '1px solid #CCC',
                };
                this.layoutSize = 105;
            }
            else {
                this.divCss = {
                    height: '95px',
                    border: '1px solid #CCC',
                };
                this.layoutSize = 95;
            }
        },
        getOption() {
            if (typeof jsObj != "undefined") {
                var computeInfo = jsObj.GetComputeInfo();
                var arr = computeInfo.split("\r");
                if (arr.length == 3) {
                    this.macaddress = arr[0];
                }
            } else {
                this.macaddress = "Default";
            }
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "getOption",
                        macaddress: this.macaddress,
                    },
                })
                .then((res) => {
                    this.OptionList = res.optionJson;
                    this.shownochkreport = res.shownochkreport;
                    this.OptionLocalList = res.optionLocalJson;
                    let option = JSON.parse(res.optionJson);
                    this.interfacename = option.READCARDCMDLINE; //调用自动读卡exe
                    this.barcodeplaceholder = option.AUTOPRINTINPUTTIPS; //输入框文字提示
                    this.rptsvr_showreq = option.RPTSVR_SHOWREQ; //显示病人申请页面s
                    this.autoprintuselisrpt = option.AUTOPRINTUSELISRPT;//门诊报告服务台使用LIS内部报告样式
                    this.forbidrptstyleid = res.forbidrptstyleid; //禁止打印报告通知单
                    if (res.reqstat) {
                        let temp = [];
                        res.reqstat.forEach((item, index) => {
                            this.reqstatOptiontable.push(item);
                        });
                        this.reqstatOptiontable.push({ data: "报告日志", display: "报告日志", inputcode: "BGRZ" });
                        this.reqstatOptiontable.push({ data: "-43", display: "无纸化", inputcode: "WZH" });
                        this.reqstatOptiontable.push({ data: "无纸化", display: "无纸化", inputcode: "WZH" });
                    }
                })
                .catch((e) => {
                    console.log("error", e);
                });
        },
        currentChangeEvent({ row }) {
            this.reportid = row.reportid;
            this.rptunitid = row.rptunitid;
            this.rowpatno = row.pat_no;
            this.rowpatname = row.pat_name;
            if (["1", "2", "8"].includes(row.unprint_flag)) {
                this.showitem = true;
                this.showmsg = row.unprint_reason;
            } else {
                //优先判断禁止打印标志，再判断是否审核吧
                this.showitem = false;
                this.getLabResult();
            }
            this.getReq();
            //查询未上机报告
            this.getUndetectionReq('0',this.rowpatno,this.rowpatname,"");
        },
        InitPageDate() {
            this.loadingLeft = true;
            this.tableDataLeft = [];
            this.printSelects = [];
            this.tableDataRight = [];

            if(!!this.barcode && this.tempBarcode != this.barcode){
                this.tempBarcode = this.barcode;
            }

            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "query",
                        macaddress: this.macaddress,
                        barcode: this.barcode,
                        req_deptno: this.req_deptno,
                        SampleDatetime1: this.SampleDatetime1,
                        SampleDatetime2: this.SampleDatetime2,
                        labgroupid: this.labgroupid,
                        deptgroup: this.deptgroup,
                        pattype: this.pattype,
                        patname: this.patname,
                        hospcode: this.hospcode,
                        patname_mh: this.sel_patname_mh,
                    },
                })
                .then((res) => {
                    this.reportKey++;
                    this.tableDataReq = res.reqData;
                    let option = JSON.parse(this.OptionList);
                    let optionLocal = JSON.parse(this.OptionLocalList);
                    if (res.Data.length == 0) {
                        //打印通知单
                        this.noticeListPrint(option, res);
                        this.barcodeplaceholder = res.barcodeMsg;
                        this.barcode = "";
                        //没有报告，但仍需要查询未上机申请单
                        this.getUndetectionReq('1',"","",this.tempBarcode);
                        // this.showMsg = true;
                        // this.msgtext = res.barcodeMsg;
                        // setTimeout(() => {
                        //     this.$refs.btnfocus0.$el.focus();
                        // }, 100);
                        // this.$alert(res.barcodeMsg, "提示", {
                        //   confirmButtonText: "确定",
                        //   callback: action => {
                        //     this.$nextTick(() => {
                        //       this.HightlightPos(this.barcode, "inpbarcode");
                        //     });
                        //   }
                        // });
                    } else {
                        this.okFirstLoading = true;
                        this.tableDataLeft = res.Data;
                        let firstrow = res.Data[0];
                        if(firstrow){
                            //查询未上机报告
                            this.getUndetectionReq('0',firstrow.pat_no,firstrow.pat_name,this.tempBarcode);
                        }
                        this.noticeListPrint(option, res); //打印通知单
                        if (optionLocal.AUTOPRINTNOTPRINTED == "1" && this.barcode.trim() != "") {
                            //服务台扫描回单号或病历号后自动打印未打印的报告,打印前20条未打印的数据
                            this.BtnPrint();
                        }
                    }
                    this.loadingLeft = false;
                    this.HightlightPos(this.barcode);
                })
                .catch((e) => {
                    this.loadingLeft = false;
                    console.log("error", e);
                });
        },
        // 打印重新采样通知单,打印报告延迟通知单
        noticeListPrint(option, res) {
            if (res.recollectPrintSql != "") {
                if (option.AUTOPRINT_RECOLLECTPRINT == 1 && res.recollectCnt > 0) {
                    //打印需重新采样通知单
                    this.$confirm("此病人有标本需要重新采样，是否打印重新采样通知单？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            //打印重新采样通知单
                            let sql = "select * from req_master_all_name where 1=1 " + res.recollectPrintSql.replace("barcode", "条码号");
                            this.$pub.printlistbill(this, sql, "1", res.resamplestyleid, "重新采样通知单", "");
                        })
                        .catch(() => {});
                }
            }
            if (res.delayPrintSql != "" && res.delayreason != "") {
                if (option.AUTOPRINT_RPTDELAYPRINT == 1 && res.delaycnt > 0) {
                    //打印报告延迟通知单
                    this.$confirm("有报告需延迟发布，是否打印报告延迟通知单？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            //打印报告延迟通知单
                            let sql = "select *,'" + res.delayreason + "' as '延迟内容' from req_master_all_name where 1=1 " + res.delayPrintSql.replace("barcode", "条码号");
                            this.$pub.printlistbill(this, sql, "1", res.rptdelaynoticestyleid, "报告延迟通知单", "");
                        })
                        .catch(() => {});
                }
            }
        },
        dialogok() {
            this.showMsg = false;
            setTimeout(() => {
                this.HightlightPos(this.barcode, "inpbarcode");
            }, 600);
        },
        BtnReadCard() {
            this.barcode = "";
            let s = this.$pub.readcardjson(this,this.interfacename);
            if (!s) {
                this.$message.error("读卡失败");
            }
            else {
                //返回卡号
                this.barcode = s;
                this.InitPageDate();
            }
        },
        BtnReHelpPrint() {
            //自助打印
            let printData = this.tableDataLeft.filter((item) => {
                return item.cp_selection == "1" && item.exprint_count != 0;
            });
            let report_idArr = [];
            printData.forEach((item) => {
                if (report_idArr.indexOf(item.reportid) > -1) {
                } else {
                    report_idArr.push(item.reportid);
                }
            });
            if (report_idArr.length > 0) {
                this.$confirm("你是否要恢复选中的报告在自助取单机上重新打印的功能？", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                })
                    .then(() => {
                        this.$tool
                            .request({
                                url: "LIS/LIS4/LIS421",
                                method: "post",
                                data: {
                                    action: "reExprintcount",
                                    report_idStr: report_idArr,
                                },
                            })
                            .then((res) => {
                                if (res.errcode == 1) {
                                    //成功
                                    this.$alert("恢复完成，共恢复 " + report_idArr.length + " 份报告", "提示", {
                                        confirmButtonText: "确定",
                                        callback: (action) => {
                                            printData.forEach((item) => {
                                                item.exprint_count = 0;
                                                item.cp_selection = 0;
                                            });
                                        },
                                    });
                                } else {
                                    //失败
                                    this.$message.error("数据库错误，更新外部打印次数失败：" + res.Data.Item2);
                                }
                            })
                            .catch((e) => {
                                console.log("error", e);
                            });
                    })
                    .catch(() => {});
            } else {
                this.$alert("所选数据外部打印次数不大于0，不需要恢复自助打印！", "提示");
            }
        },
        BtnQuery() {
            //查询
            this.InitPageDate();
        },
        getUndetectionReq(type,pat_no, pat_name, barcode){
            //type为1用barcode查询，为0用pat_no和pat_name查询
            this.tableDataReqUndetection = [];
            this.tableDataReqUndetectionLog = [];

            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "getUndetectionReq",
                        type: type,
                        barcode: barcode,
                        patno: pat_no,
                        patname: pat_name,
                    },
                })
                .then((res) => {
                    if(res.errcode == '1'){
                        this.tableDataReqUndetection = res.Data;
                        var undetectionCnt = 0;
                        if(res.Data.length > 0) {
                            undetectionCnt = res.Data.length;
                            //获取申请单日志
                            var row = res.Data[0];
                            //设置选中第一条
                            this.$refs.xTable_Undetection.setCurrentRow(this.tableDataReqUndetection[0]);
                            this.getUndetectionReqLog(row.barcode);
                        }
                        if(undetectionCnt > 0){
                            this.UndetectionTitle = '未上机申请单 '+ undetectionCnt;
                            this.showUndetectionNum = '1';
                        }
                        else{
                            this.UndetectionTitle = '未上机申请单';
                            this.showUndetectionNum = '0';
                        }
                    }
                    else {
                        this.UndetectionTitle = '未上机申请单';
                        this.showUndetectionNum = '0';
                    }
                })
                .catch((e) => {
                    this.$message.error(e);
                    console.log("error", e);
                });
        },
        getUndetectionReqLog(barcode){
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "getUndetectionReqLog",
                        barcode: barcode,
                    },
                })
                .then((res) => {
                    this.tableDataReqUndetectionLog = this.DealLog(res);
                });
        },
        DealLog(res) {
            var data = res.Data.Data;
            var rptlogdt = res.reportlogdt;
            var bactlogdt = res.bactlogdt;
            var redata = [];
            for (let i = 0; i < data.length; i++) {
                if (data[i].reportid) {
                    var children = rptlogdt.filter((item) => item.reportid == data[i].reportid);
                    if (children.length > 0) data[i].children = children;
                }
                if(data[i].sampleid && data[i].trans_type=='-43'){
                    if(bactlogdt && bactlogdt.length>0){
                        data[i].children = bactlogdt;
                    }
                }
                redata.push(data[i]);
            }
            return redata;
        },
        currentUndetectionChangeEvent({ row }){
            this.getUndetectionReqLog(row.barcode);
        },
        BtnPrint() {
            //打印
            let printData = this.tableDataLeft.filter((item) => {
                return item.cp_selection == "1";
            });

            let len = printData.length;
            if (len > 0) {
                let name = [];
                printData.forEach((item) => {
                    //遍历是否有不一样的的姓名的患者打印报告，有则提醒
                    if (name.indexOf(item.pat_name) > -1) {
                        //throw Error();
                    } else {
                        name.push(item.pat_name);
                    }
                });
                if (name.length > 1) {
                    //有至少两个人的报告
                    this.$confirm("当前选中多个病人的报告单，你确定要打印吗？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            this.PrintReport(len);
                        })
                        .catch((e) => {});
                } else {
                    //只有一个人的报告
                    this.PrintReport(len);
                }
            }
        },
        PrintReport(len) {
            this.msg = "正在打印，共" + len + "份报告";
            this.dialogVisible = true;
            // this.tableDataLeft.forEach((item) => {
                this.$refs.xTable1.afterFullData.forEach((item) => {
                if (item.cp_selection == "1") {
                    if (this.autoprintuselisrpt == "1" || this.autoprintuselisrpt == "2") {
                        //报告使用LIS内部报告样式
                        this.$pub.printreport(this, item.reportid, "1", "", "1");
                    } else {
                        this.$pub.printreport(this, item.reportid, "1", "", "2");
                    }
                    let k = Number(item.print_count);
                    item.print_count = k + 1;
                }
            });
            setTimeout(() => {
                this.dialogVisible = false;
            }, 2000);
        },
        BtnPreView() {
            //添加多份报告预览
            //多份报告预览按照点击列头排序顺序预览
            // let viewData = this.tableDataLeft.filter((item) => {
            let viewData =  this.$refs.xTable1.afterFullData.filter((item) => {
                return item.cp_selection == "1" && item.rechkflag == "9" && item.unprint_flag != "8";
            });
            let styletype = "2";
            //报告使用LIS内部报告样式
            if (this.autoprintuselisrpt == "1" || this.autoprintuselisrpt == "2") styletype = "1";
            let len = viewData.length;
            if (len > 0) {
                let name = [];
                let reportidlist = "";
                viewData.forEach((item) => {
                    reportidlist += item.reportid + ",";
                    //遍历是否有不一样的的姓名的患者预览报告，有则提醒
                    if (name.indexOf(item.pat_name) > -1) {
                        //throw Error();
                    } else {
                        name.push(item.pat_name);
                    }
                });
                if (reportidlist != "") reportidlist = reportidlist.substring(0, reportidlist.length - 1);
                if (name.length > 1) {
                    //有至少两个人的报告
                    this.$confirm("当前选中多个病人的报告单，你确定要预览吗？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            this.$pub.printreport(this, reportidlist, "2", "",styletype,"1");
                        })
                        .catch((e) => {});
                } else {
                    //只有一个人的报告
                    this.$pub.printreport(this, reportidlist, "2", "", styletype, "1");
                }
            } else {
                //预览()
                var currRow = this.$refs.xTable1.getCurrentRow();
                if (currRow.rechkflag != "9") {
                    this.$message.warning("不可查看未审核的报告");
                    return;
                }
                if (this.reportid != "") {
                    this.$pub.printreport(this, this.reportid, "2", "", styletype, "1");
                }
            }
        },
        //清除勾选
        BtnClearCheck() {
            this.funSelect("c");
        },
        //清除条件
        BtnClearSearch() {
            this.getOption(); //初始化下拉框的数据
            this.SampleDatetime1 = this.$pub.InitDateTime2(30).datefrom;
            this.SampleDatetime2 = this.$pub.InitDateTime2(30).dateto;
            this.barcode = "";
            this.tempBarcode = "";
            this.patname = "";
            this.BtnSelectAllChecked = "0";
            this.BtnAllPrintedChecked = "0";
            this.pattype = "";
            this.labgroupid = "";
            this.req_deptno = "";
            this.hospcode = "";
            this.tableDataRight =[];
            this.tableDataLeft =[];
            this.showmsg = "";
            this.sel_patname_mh = "0";
            // 获取焦点
            this.$refs.searchbarcode.focus();
            this.$refs.searchbarcode.select();
            //this.BtnQuery();
        },
        BtnSelectAll() {
            //全选未打印
            this.funSelect("w");
        },
        BtnAllPrinted() {
            //全选已打印
            this.funSelect("y");
        },
        funSelect(char) {
            switch (char) {
                case "c": //清除
                    this.tableDataLeft.forEach((item) => {
                        item.cp_selection = "0";
                    });
                    break;
                case "w": //未打印
                    this.tableDataLeft.forEach((item) => {
                        if (item.print_count == "0") {
                            if (["1", "2", "8"].includes(item.unprint_flag) || item.rechkflag != "9" || item.notserviceprint == "1" || item.prereport == "1") {
                                item.cp_selection = "0";
                            } else {
                                item.cp_selection = "1";
                            }
                        } else {
                            item.cp_selection = "0";
                        }
                    });
                    break;
                case "y": //已打印
                    this.tableDataLeft.forEach((item) => {
                        //  if (item.print_count > 0) {
                        if (["1", "2", "8"].includes(item.unprint_flag) || item.rechkflag != 9 || item.notserviceprint == "1" || item.prereport == "1") {
                            //未审核禁止勾选打印
                            item.cp_selection = "0";
                        } else {
                            item.cp_selection = "1";
                        }
                        // } else {
                        //     item.cp_selection = "";
                        // }
                    });
                    break;
                default:
                    break;
            }
        },
        handleCheckedPrintChange(row, rowIndex) {
            //控制单选状态
            if (row.cp_selection != "0") {
                if (row.notserviceprint == "1") {
                    this.$alert("当前报告不可在服务台打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
                if (row.rechkflag != 9) {
                    //9已审核
                    this.$alert("当前报告未审核，不可打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
                if (row.prereport == "1") {
                    this.$alert("当前报告为初步报告，只可查询，不可打印！", "提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$nextTick(() => {
                                row.cp_selection = "0";
                            });
                        },
                    });
                }
                if (["1", "2", "8"].includes(row.unprint_flag)) {
                    if (row.unprint_flag == "1") {
                        this.$confirm("当前报告禁止自助打印，" + row.unprint_reason + "，打印未通过，你是否确定要服务台打印？", "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            type: "warning",
                        })
                            .then(() => {
                                this.$nextTick(() => {
                                    row.cp_selection = "1";
                                });
                            })
                            .catch((e) => {
                                this.$nextTick(() => {
                                    row.cp_selection = "0";
                                });
                            });
                    } else if (["2", "8"].includes(row.unprint_flag)) {
                        let msg = "当前报告禁止在服务台打印！";
                        if (row.unprint_flag == "8") {
                            msg = "当前报告需要单独授权才能打印，请到指定地点或用户处打印！";
                        }
                        // this.$alert(msg, "提示", {
                        //     confirmButtonText: "确定",
                        //     callback: (action) => {
                        //         this.$nextTick(() => {
                        //             row.cp_selection = "0";
                        //         });
                        //     },
                        // });
                        //是否打印禁止打印通知单
                        this.$confirm(msg + "是否打印禁止打印通知单？", "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            type: "warning",
                        })
                            .then(() => {
                                //打印禁止打印报告通知单
                                row.cp_selection = "0";
                                let sql = "select *,'" + row.unprint_reason + "' as '禁止打印原因' from req_master_all_name where 1=1 and 条码号='" + row.barcode + "'";
                                this.$pub.printlistbill(this, sql, "1", this.forbidrptstyleid, "禁止打印报告通知单", "");
                            })
                            .catch(() => {
                                row.cp_selection = "0";
                            });
                    }
                } else {
                    this.$nextTick(() => {
                        row.cp_selection == "0" ? "1" : "0";
                    });
                }
            }
        },
        getLabResult() {
            this.loadingRight = true;
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "getLabResult",
                        reportid: this.reportid,
                        rptunitid: this.rptunitid,
                        macaddress: this.macaddress,
                    },
                })
                .then((res) => {
                    if (res.nocheckflag) {
                        //添加对不显示结果列的判断
                        this.showitem = true;
                        this.showmsg = "报告未审核";
                    } else {
                        this.novisible = res.noVisible;
                        let resultText = res.resultText; //控制是否以及显示的列名名字
                        this.result1text = res.result1text;
                        this.result2text = res.result2text;
                        this.result3text = res.result3text;
                        this.result1 = res.result1;
                        this.result2 = res.result2;
                        this.result3 = res.result3;
                        this.tableDataRight = res.Data;
                        this.loadingRight = false;
                    }
                    if(res.rpttype == "2"){
                        this.rpttype = "2";
                        if (res.Data.length > 0) {
                            setTimeout(() => {
                                this.$refs.xTable2.setCurrentRow(this.tableDataRight[0]);
                                this.queryMedResult(this.tableDataRight[0]);
                            }, 80);
                        }
                    }
                    else if (res.rpttype == "3") {
                        this.rpttype = "3";
                        this.image = "";
                        this.QueryImagePDF(row.reportid);
                    }
                    else{
                        this.rpttype = "1";
                    }
                })
                .catch((e) => {
                    this.loadingRight = false;
                    console.log("error", e);
                });
        },
        queryMedResult(row) {
            this.resusltmed_date = [];
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "get_lab_resultmed",
                        reportid: row.reportid,
                        rpt_itemcode: row.rpt_itemcode,
                        macaddress: this.macaddress,
                    },
                })
                .then((res) => {
                    // console.log("🚸 —— .then —— res", res);
                    this.resusltmed_date = res;
                })
                .catch((e) => {
                    this.$message.error(e);
                });
        },
        resultChange({ row, rowIndex, column, columnIndex }, event) {
            this.queryMedResult(row);
        },
        QueryImagePDF(reportid) {
            if (reportid) {
                this.$tool
                    .request({
                        url: "/ucent/downloadfile",
                        method: "post",
                        responseType: "blob",
                        data: {
                            prgno: "LIS312",
                            reportid: reportid,
                        },
                    })
                    .then((res) => {
                        let blob = new Blob([res], {
                            type: "application/pdf",
                        });
                        let objectUrl = window.URL.createObjectURL(blob);
                        this.image = objectUrl;
                    });
            } else {
                this.image = "";
            }
        },
        getReq() {
            this.loading = true;
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "getReq",
                        macaddress: this.macaddress,
                        barcode: this.tempBarcode,
                        patno: this.rowpatno,
                        patname: this.rowpatname,
                    },
                })
                .then((res) => {
                    this.tableDataReq = res.Data;
                    this.loading = false;
                })
                .catch((e) => {
                    this.loading = false;
                    console.log("error", e);
                });
        },
        BarCodeSelect(id) {
            this.HightlightPos(this.barcode, id);
        },
        PatNameSelect(id) {
            this.HightlightPos(this.patname, id);
        },
        HightlightPos(myValue, id) {
            if (myValue == "") {
                return false;
            }
            var myField = document.getElementById(id);
            if (myField.selectionStart || myField.selectionStart === 0) {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;
                this.$nextTick(() => {
                    myField.selectionStart = 0;
                    myField.selectionEnd = startPos + myValue.length;
                });
                myField.focus();
                myField.setSelectionRange(myField, myField.selectionStart, myField.selectionEnd);
            }
        },
        handleClick(tab, event) {
            if(tab.name == "third" || tab.name == "TabColorUndetection"){
                this.undetectionkey++;
                this.undetectionlogkey++;
                //重新加载数据，避免table样式变形
            }
            if (tab.name == "second") {
                this.testkey++;
                this.getReq();
            }
            if (tab.name == "first") {
                this.reportKey++;
            }
        },
        FormateFun({ row, cellValue, column }) {
            // if (column.property == "rechk_dt") {
            //   if (cellValue != null) {
            //     return "审";
            //   } else {
            //     return "";
            //   }
            // } else if
            if (column.property == "unprint_flag") {
                if (cellValue == 1) {
                    return "禁止自助";
                } else {
                    return "";
                }
            }
        },
        cellClassName({ column, row, columnIndex }) {
            if (columnIndex == "1") {
                return "col-black";
            } else if (column.property == "cp_selection") {
                if (column.property == "cp_selection" && row.cp_selection == 1) {
                    return "col-green";
                }

                if (row.notserviceprint == "1" || row.rechkflag != "9" || row.prereport == "1" || ["1", "2", "8"].includes(row.unprint_flag)) {
                    return "col-gray";
                }
                return "";
            } else if (column.property == "pat_name") {
                return "col-blue";
            } else if (column.property == "unprint_reason") {
                return "col-red";
            } else {
            }
        },
        cellClassName_REQ({ column, row, columnIndex }) {
            if (column.property == "emer_flag") {
                return "col-red";
            }
        },
        rowClassName_REQ({ column, row, columnIndex, cellValue }) {
            switch (row.req_stat) {
                case "1":
                    return "stat-1";
                case "2":
                    return "stat-2";
                case "3":
                    return "stat-3";
                case "4":
                    return "stat-4";
                case "5":
                    return "stat-5";
                case "6":
                    return "stat-6";
                case "8":
                    return "stat-8";
                case "9":
                    return "stat-9";
                default:
                    return "";
            }
        },
        rowClassName({ row, rowIndex }) {
            //控制行的背景颜色
            // if (row.print_count > 0) {
            //   if (row.rechk_dt == null) {

            //   }
            //   return "row-gray";
            // }
            // else {
            // return "";
            // }
            if (row.print_count > 0 && row.rechkflag != "9") return "row-pink";
            return "";
        },
        format({ row, column, cellValue }) {
            if (column.property == "alter_flag") {
                if (cellValue != "0") {
                    return "警";
                } else {
                    return "";
                }
            } else if (column.property == "reqtype") {
                if (cellValue == "C") {
                    return "检验";
                } else {
                    return "输血";
                }
            }
        },
        xTable1Celldblclick({ row, column }) {
            if (column.property == "pat_no") {
                this.barcode = row.pat_no;
                this.InitPageDate();
            } else if (column.property == "pat_name") {
                this.patname = row.pat_name;
                this.InitPageDate();
            } else if (column.property == "print_count") {
                this.OperateDialog = true;
                this.cellDblclickPrintCount();
            } else if (column.property == "pat_idcardno" && row.pat_idcardnoen && row.pat_idcardnoen.length > 0) {
                this.Dec(row.pat_idcardnoen, "身份证/护照号");
            } else if (column.property == "pat_phone" && row.pat_phoneen && row.pat_phoneen.length > 0) {
                this.Dec(row.pat_phoneen, "电话");
            }
        },
        cellDblclickPrintCount() {
            this.xTable4loading = true;
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS421",
                    method: "post",
                    data: {
                        action: "getReportlog",
                        reportid: this.reportid,
                    },
                })
                .then((res) => {
                    this.tableData4 = res.Data;
                    this.xTable4loading = false;
                })
                .catch((e) => {
                    console.log("error", e);
                    this.xTable4loading = false;
                });
        },
        repalceComputerName(row) {
            this.$pub.getComputerName(row.mac_address)
                .then((name)=> {
                    row.computer_name = name;
                })
                .catch(()=> {
                    this.$message.error("机器名称查询失败！");
                    //保持原样
                });
        },
    },
};
</script>

<style scoped>
.table1style tr td {
    padding: 1px 2px 1px 2px;
}
.middle-tab-top {
    position: absolute;
    top: 0px;
    width: 100%;
    height: 300px;
}

.middle-tab-bottom {
    position: absolute;
    top: 0px;
    width: 100%;
    bottom: 0px;
    overflow: auto;
}


.right-inser {
    position: absolute;
    top: 0;
    bottom: 0px;
    overflow: auto;
    width: 100%;
    right: 0px;
    height: 100%;
}

::v-deep .vxe-table .vxe-body--row.row-gray {
    background-color: #e6e6e6;
}
::v-deep .vxe-table .vxe-body--row.row-pink {
    background-color: #ffc0c0;
}
::v-deep .vxe-table .vxe-body--column.col-gray {
    background-color: #e6e6e6;
}
::v-deep .vxe-table .vxe-body--column.col-blue {
    color: blue;
}
::v-deep .vxe-table .vxe-body--column.col-red {
    color: red;
}
::v-deep .vxe-table .vxe-body--column.col-black {
    color: #000000;
    font-weight: 800;
}
::v-deep .vxe-table .vxe-body--column.col-green {
    background-color: #7fffaa;
}

::v-deep .Listclass .vxe-table .vxe-cell {
    padding: 0px;
}

::v-deep .vxe-table .vxe-body--row.stat-1 {
    color: black !important;
    background-color: rgb(192, 192, 255) !important;
    /*background-color: #c0c0ff; /*淡褐*/
}

::v-deep .vxe-table .vxe-body--row.stat-2 {
    background-color: rgb(128, 128, 255) !important;
    /*background-color: #8080ff; /*褐*/
    color: #f0f8ff; /*白*/
}

::v-deep .vxe-table .vxe-body--row.stat-3 {
    background-color: rgb(64, 64, 255) !important;
    /*background-color: #0000ff; /*蓝*/
    color: #f0f8ff; /*白*/
}

::v-deep .vxe-table .vxe-body--row.stat-4 {
    background-color: rgb(220, 255, 220) !important;
    /* background-color: #33ffcc; /*亮青*/
}
::v-deep .vxe-table .vxe-body--row.stat-5 {
    background-color: rgb(192, 255, 192) !important;
    /*background-color: #c0ffc0; /*淡青*/
}

::v-deep .vxe-table .vxe-body--row.stat-6 {
    background-color: rgb(128, 255, 128) !important;
    /* background-color: #80ff80; /*青*/
}

::v-deep .vxe-table .vxe-body--row.stat-8 {
    background-color: rgb(255, 128, 128) !important;
    /*background-color: #ff8080; /*橙*/
    color: #f0f8ff; /*白*/
}

::v-deep .vxe-table .vxe-body--row.stat-9 {
    background-color: rgb(64, 64, 64) !important;
    /*background-color: #bbbbbb; /*灰*/
    color: #f0f8ff; /*白*/
    background-color: #c0c0ff; /*淡褐*/
}

::v-deep .vxe-table .vxe-body--row.stat-2 {
    background-color: #8080ff; /*褐*/
    color: #f0f8ff; /*白*/
}

::v-deep .vxe-table .vxe-body--row.stat-3 {
    background-color: #0000ff; /*蓝*/
    color: #f0f8ff; /*白*/
}

::v-deep .vxe-table .vxe-body--row.stat-4 {
    background-color: #33ffcc; /*亮青*/
}
::v-deep .vxe-table .vxe-body--row.stat-5 {
    background-color: #c0ffc0; /*淡青*/
}

::v-deep .vxe-table .vxe-body--row.stat-6 {
    background-color: #80ff80; /*青*/
}

::v-deep .vxe-table .vxe-body--row.stat-8 {
    background-color: #ff8080; /*橙*/
    color: #f0f8ff; /*白*/
}

::v-deep .vxe-table .vxe-body--row.stat-9 {
    background-color: #bbbbbb; /*灰*/
    color: #f0f8ff; /*白*/
}

::v-deep .el-input-group__append,
.el-input-group__prepend {
    background-color: #0095d9;
    color: #f1f2f4;
}

::v-deep #tab-TabColorUndetection {
    color: red;
}
</style>